const finanInventory = {
  state: {
    warehouseId: "",
    inventoryStatus: false,
    // 采购清单第一条数据
    purchaseListData: {},
    // 判断填报单位是否切换
    reportChange: false,
    // 盘点数量总和
    inventoryCount: "",
    // 删除状态
    removeStatus: false,
    // 是否盈亏 0 盘盈，1盘亏 2 盘0
    isProfit: 2
  },
  mutations: {
    SET_WAREHOUSEID: (state, data) => {
      state.warehouseId = data;
    },
    SET_INVENTORY_STATUS: (state, data) => {
      state.inventoryStatus = data;
    },
    SET_PURCHASELIST_DATA: (state, data) => {
      state.purchaseListData = data;
    },
    SET_REPORTCHANGE: (state, data) => {
      state.reportChange = data;
    },
    SET_INVENTORY_COUNT: (state, data) => {
      state.inventoryCount = data;
    },
    SET_REMOVE_STATUS: (state, data) => {
      state.removeStatus = data;
    },
    SET_IS_PROFIT: (state, data) => {
      state.isProfit = data;
    },
    RESET: (state, data) => {
      state.warehouseId = "";
      state.inventoryStatus = false;
      state.purchaseListData = {};
      state.reportChange = false;
      state.inventoryCount = "";
      state.removeStatus = false;
      state.isProfit = 2
    },
  },
  actions: {
    setBusinessList({ commit }, data) {
      commit("SET_WAREHOUSEID", data);
    },
    setInventoryStatus({ commit }, data) {
      commit("SET_INVENTORY_STATUS", data);
    },
    setPurchaseListData({ commit }, data) {
      commit("SET_PURCHASELIST_DATA", data);
    },
    setReportChange({ commit }, data) {
      commit("SET_REPORTCHANGE", data);
    },
    setInventoryCount({ commit }, data) {
      commit("SET_INVENTORY_COUNT", data);
    },
    setRemoveStatus({ commit }, data) {
      commit("SET_REMOVE_STATUS", data);
    },
    setIsProfit({ commit }, data) {
      commit("SET_IS_PROFIT", data);
    },
    reset({ commit }) {
      commit("RESET");
    },
  },
};

export default finanInventory;
